
<%
	long wn_id = task.doTask();
	Record ref = task.getWN_Ref();
%>

<link href="style.css" rel="stylesheet" type="text/css">

<script language="javascript">

</script>
<form method="POST" name="formMain" action="" onSubmit="">				  
	<table width="100%"  border="0" class="style2">
		<tr>
			<td colspan="2"><img src="images/import-wn.jpg" width="200" height="20"></td>
		</tr>
          <tr bgcolor="#EEEEEE" class="style3" align="center" style="font-weight:bold">
            <td width="17%">WN Ref </td>
            <td width="83%" align="left"><label id="e16">Details</label></td>
          </tr>
          <tr>
            <td valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td colspan="2"><select name="wn_id" size=19 class="style2" id="wn_id" style="width:100%;" onChange="doPost();">
              <%task.getResponse().setOption(task.getWN_List());%>
              <%task.getResponse().setSelected("wn_id");%>
            </select></td>
  </tr>
  <tr>
    <td width="14%"><img src="images/new.gif" border="0" width="15" height="15" onClick="new_WN('<%=task.getNew_WN()%>')"></td>
    <td width="86%"><img src="images/delete.gif" width="15" height="15" border="0" onClick="delete_DSI('qr','Quality Report')"></td>
  </tr>
</table>
</td>
            <td valign="top"><table width="100%"  border="1" cellspacing="0" cellpadding="0">
	  <tr>
    <td><table width="100%"  border="0" cellpadding="0" cellspacing="0" class="style2">
              <tr>
                <td><table width="100%"  border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td><table width="100%"  border="0" cellpadding="1" cellspacing="1" class="style2">
                      <tr>
                        <td width="20%">&nbsp;</td>
                        <td width="29%">&nbsp;</td>
                        <td width="19%">&nbsp;</td>
                        <td>&nbsp;</td>
                      </tr>
                      <tr>
                        <td align="right">Contract Ref &nbsp;</td>
                        <td><strong><%=ref.getString("ct_ref_number")%> (<%=ref.getString("contract_no")%>)</strong></td>
                        <td align="right">Origin &nbsp;</td>
                        <td><strong><%=ref.getString("origin")%></strong></td>
                      </tr>
                      <tr>
                        <td align="right">Supplier &nbsp;</td>
                        <td><strong><%=ref.getString("supplier")%></strong></td>
                        <td align="right">Quality &nbsp;</td>
                        <td><strong><%=ref.getString("quality")%></strong></td>
                      </tr>
                      <tr>
                        <td align="right">DI Ref &nbsp;</td>
                        <td><strong><%=ref.getString("di_ref_number")%></strong></td>
                        <td align="right">Grade &nbsp;</td>
                        <td><strong><%=ref.getString("grade")%></strong></td>
                      </tr>
                      <tr>
                        <td align="right">Quantity&nbsp;</td>
                        <td colspan="2"><strong><%=ref.getFloatValue("di_tons")%> Mts / <%=ref.getString("di_no_of_bags")%> <%=ref.getString("packing")%>s</strong></td>
                        <td>&nbsp;</td>
                      </tr>
                      <tr>
                        <td><strong>Weight Note </strong></td>
                        <td colspan="2">&nbsp;</td>
                        <td>&nbsp;</td>
                      </tr>
                      <tr>
                        <td colspan="4"><table width="100%"  border="0" cellpadding="1" cellspacing="1" class="style2">
                          <tr align="center" bgcolor="#EEEEEE" style="font-weight:bold">
                            <td width="4%" rowspan="2">ID</td>
                            <td width="13%" rowspan="2">WN Ref </td>
                            <td width="17%" rowspan="2">Date</td>
                            <td width="19%" rowspan="2">Time</td>
                            <td colspan="3">Tons</td>
                            </tr>
                          <tr align="center" bgcolor="#EEEEEE">
                            <td width="17%">Gross</td>
                            <td width="15%">Tare</td>
                            <td width="15%">Net</td>
                          </tr>
                          <tr>
                            <td align="right"><%=ref.getInt("id")%></td>
                            <td><%=ref.getString("ref_number")%></td>
                            <td><%=ref.getDate("date")%></td>
                            <td>&nbsp;</td>
                            <td colspan="3">&nbsp;</td>
                          </tr>
                        </table></td>
                      </tr>
                    </table></td>
                  </tr>
                </table></td>
              </tr>
			  <tr>
			    <td>&nbsp;</td>
		      </tr>
			  <tr>
			    <td><strong>WNR Ref </strong></td>
			  </tr>
              <tr>
                <td><table width="100%"  border="0" cellpadding="1" cellspacing="1" class="style2">
                  <tr style="font-weight:bold" bgcolor="#EEEEEE" align="center">
                    <td width="31" rowspan="2">No</td>
                    <td width="142" rowspan="2">DI Ref </td>
                    <td width="233" rowspan="2">Destination</td>
                    <td colspan="2">Quantity</td>
                    <td colspan="2">Delivered</td>
                    <td colspan="2">Delivery Period </td>
                  </tr>
                  <tr style="font-weight:bold" bgcolor="#EEEEEE" align="center">
                    <td width="75">Tons</td>
                    <td width="70">Bags</td>
                    <td width="72">Tons</td>
                    <td width="63">Bags</td>
                    <td width="68">From</td>
                    <td width="75">To</td>
                  </tr>
<%
	Record rc = new Record(task.getWNR_Detail());
	rc.beforeFirst();
	while (rc.next()) {
%>				  
                  <tr class="style11" onClick="highlightOn(this);" onDblClick="doLink('traffic.di.jsp?view=1&di_id=<%=rc.getInt("id")%>')">
                    <td align="center" bgcolor="#EEEEEE"><%=rc.getRow()%></td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td align="right">&nbsp;</td>
                    <td align="right">&nbsp;</td>
                    <td align="right">&nbsp;</td>
                    <td align="right">&nbsp;</td>
                    <td align="center">&nbsp;</td>
                    <td align="center">&nbsp;</td>
                  </tr>
<%
	}
%>				  
                  <tr class="style2">
                    <td align="center"bgcolor="#EEEEEE">&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td align="right">&nbsp;</td>
                    <td align="right">&nbsp;</td>
                    <td align="right">&nbsp;</td>
                    <td align="right">&nbsp;</td>
                    <td align="center">&nbsp;</td>
                    <td align="center">&nbsp;</td>
                  </tr>
                  <tr class="style2" bgcolor="#EEEEEE">
                    <td align="center"><img src="../shared/images/new.gif" width="15" height="15" title="Create New DI" onClick="doLink('traffic.di.jsp?view=1&di_id=-1')"></td>
                    <td>&nbsp;</td>
                    <td><strong>Total</strong></td>
                    <td align="right">&nbsp;</td>
                    <td align="right">&nbsp;</td>
                    <td align="right">&nbsp;</td>
                    <td align="right">&nbsp;</td>
                    <td align="center">&nbsp;</td>
                    <td align="center">&nbsp;</td>
                  </tr>
                </table></td>
              </tr>
			  <tr>
			  	<td>&nbsp;</td>
			  </tr>
            </table></td>
  </tr>
</table>
</td>
          </tr>
		  <tr id="di_list_view">
			  <td colspan="2"  valign="top">
		  
			  </td>
		  </tr>
		  <tr id="di_buttons" style="display:">
             <td colspan="2"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
               <tr>
                 <td>&nbsp;</td>
                 <td width="5%"><img src="../shared/images/listview.jpg" width="55" height="18" onClick="setValue('view',0);doLink('traffic.physical.jsp')"></td>
               </tr>
             </table></td>
	      </tr>
  </table>
	<input type="hidden" name="uid"  id="uid"  value="<%=user.getuid()%>">
	<input type="hidden" name="task_id"  id="task_id"  value="0">
	<input type="hidden" name="view" id="view" value="<%=task.getRequest().getIntValue("view")%>">	
	<input type="hidden" name="inst_id"  id="inst_id"  value="<%=task.getRequest().getIntValue("inst_id")%>">
</form>

<script language="javascript">
	hide("sub_menu_3");
	setCbx(getObj("status_"), <%=ref.getIntValue("status")%>);

	if (getValue("wn_id") == 0) hide("update_btn");

	if (<%=wn_id == -1%>) {	
		var idx = addNewListItem(document.formMain.wn_id,"<%=task.getNew_WN()%>");
		setText("ref_number_",getSelectedText("wn_id"));
	}

	getObj("main_window").width = "800";
</script>

